<?php

class Default_BuddyController extends Ext_Controller_Action_Front
{
    public function init()
    {
        Zend_Registry::set('_use_adapter', 'master');
        
        parent::init();
    }
    
    public function saveBuddyAction()
    {
        $viewResult = new Ext_View_Result();
        
        $buddyUserId = $this->filter->filter($this->_request->getPost('buddyUserId'));
        $buddy       = $this->filter->filter($this->_request->getPost('buddy'));
        
        $buddior = new Ext_Buddy_Save($buddyUserId);
        if(!$buddior->save($buddy)){
            $viewResult->addMessages($buddior->getMessages());
            $viewResult->setNoRender();
            return "";
        }
        
        //Zend_Debug::dump($buddy, 'buddy');
        
        if($buddy == 'add'){
            $isBuddy = 1;
        }else{
            $isBuddy = 0;
        }
        $this->view->isBuddy = $isBuddy;
        $viewResult->setResult(1);
    }
}

?>